#ifndef __EULER_ANGLE_CLASS_DEFINE__
#define __EULER_ANGLE_CLASS_DEFINE__

#pragma once
#include "framework.h"
#include "MatrixInformation.h"
/*
                [cosb  sinb  0]
B = Rz(b) =        [-sinb cosb  0]
                [0      0    1]

                [1    0    0  ]
P = Rx(p) =        [0  cosp  sinp]
                [0  -sinp cosp]

                [cosh  0 -sinh]
H = Ry(h) =        [0     1     0]
                [sinh  0  cosh]

    欧拉角的限制范围：
        heading: -180°~ +180°
        bank:     -180°~ +180°
        pitch:     -90° ~ +90°

*/
class MatrixInformation;


class EulerAngle
{
private: 
    double heading;// 绕Y轴旋转
    double pitch;// 绕X轴旋转
    double bank;// 绕Z轴旋转

public:
    EulerAngle();
    EulerAngle(double heading, double pitch, double bank);

    double GetHeading() { return this->heading; };
    double GetPitch() { return this->pitch; };
    double GetBank() { return this->bank; };

    // 物体坐标系转换到世界坐标系
    VOID FromMatrixObjectToWorld(MatrixInformation& matrixInfo);
    // 世界坐标系转换到物体坐标系
    VOID FromMatrixWorldToObject(MatrixInformation& matrixInfo);
    // 角度限制,避免万向锁
    VOID AngleLimit();
    // 角度修正
    double AngleCorrection(double angle);
};

#endif // !__EULER_ANGLE_CLASS_DEFINE__
